home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tex / epic.shar1 (.txt) < prev    next >
Encoding:
Texinfo Document  |  1988-04-18  |  30.2 KB  |  648 lines

  1. #! /bin/sh
  2. # This is a shell archive, meaning:
  3. # 1. Remove everything above the #! /bin/sh line.
  4. # 2. Save the resulting text in a file.
  5. # 3. Execute the file with /bin/sh (not csh) to create:
  6. #    epic.readme
  7. #    epic.sty
  8. #    misc.sty
  9. # This archive created: Mon Mar  9 01:36:59 1987
  10. # By:    SKY ()
  11. export PATH; PATH=/bin:/usr/bin:$PATH
  12. echo shar: "extracting 'epic.readme'" '(1291 characters)'
  13. if test -f 'epic.readme'
  14.     echo shar: "will not over-write existing file 'epic.readme'"
  15. cat << \SHAR_EOF > 'epic.readme'
  16. Following stuff is contained in this package:
  17. 1. epic.sty    documentstyle option for "Enhancements to Picture
  18.         Environment". In its present form, will only work
  19.         with LaTeX.
  20. 2. misc.sty     documentstyle option containing miscalleneous macros.
  21.         In particular, one for printing files verbatim.
  22.         used by picman.tex; quite useful otherwise.
  23. 3. picman.tex    manual for epic.
  24. 4. picman-fig*.tex manual related files.
  25. 5. sqrt.tex    appendix to manual.
  26. Run the manual in the directory as the one where all the files are. To run
  27. it, say "latex picman.tex".
  28. As is discussed on the first page of the manual, there are two ways
  29. of going about making the macro files acessible to users via the option
  30. mechanism of \documentstyle command:
  31. 1. simplest is to put a copy in the directory where all such things
  32. reside (typically /usr/lib/tex/macros).
  33. 2. keep the files somewhere in your area, and have all the users
  34. declare a shell environment variable TEXINPUTS (typically done in
  35. the ~/.cshrc file); something like:
  36. setenv TEXINPUTS .:/usr/lilb/tex/macros:/users/yourself/texlib
  37. Otherwise the files can be explicitly \input with full path name
  38. and the .sty extension:
  39. \input{/..../epic.sty}
  40. You might wish to move the manual files to a subdirectory "man";
  41. mkdir man
  42. mv picman* man
  43. Have fun.
  44. sunil podar
  45. SHAR_EOF
  46. if test 1291 -ne "`wc -c < 'epic.readme'`"
  47.     echo shar: "error transmitting 'epic.readme'" '(should have been 1291 characters)'
  48. echo shar: "extracting 'epic.sty'" '(25824 characters)'
  49. if test -f 'epic.sty'
  50.     echo shar: "will not over-write existing file 'epic.sty'"
  51. cat << \SHAR_EOF > 'epic.sty'
  52. \makeatletter
  53. \typeout{%
  54. Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986}
  55. %----------------------------------------------------------------------
  56. % Copyright (C) podar@sbcs (Sunil Podar) July 14,1986.
  57. % You may use this file in whatever way you wish. You are requested to 
  58. % leave this notice intact, and report any bugs, enhancements, comments,
  59. % suggestions, etc. to:
  60. % USmail: Sunil Podar,Dept. of Computer Science,SUNY at Stony Brook,NY 11794.
  61. %  CSNET: podar@sbcs.csnet
  62. %   ARPA: podar%suny-sb.csnet@csnet-relay.arpa
  63. %   UUCP: {allegra, hocsd, philabs, ogcvax}!sbcs!podar
  64. %----------------------------------------------------------------------
  65. % This file contains implementation of:
  66. % \multiputlist    \matrixput    \grid        \picsquare
  67. % \dottedline    \dashline    \drawline    \jput
  68. % \putfile
  69. % Environments: dottedjoin, dashjoin and drawjoin
  70. % For documentation, see the accompanying manual.
  71. %----------------------------------------------------------------------
  72. % usage: \multiputlist(x,y)(delta-x,delta-y)[tbrl]{item1,item2,item3,.....}
  73. % \lop and \lopoff taken from TeXbook.
  74. %----------------------------------------------------------------------
  75. \def\lop#1\to#2{\expandafter\lopoff#1\lopoff#1#2}
  76. \long\def\lopoff,#1,#2\lopoff#3#4{\def#4{#1}\def#3{,#2}}
  77. \def\@@mlistempty{,}
  78. \newif\iflistnonempty
  79. \def\multiputlist(#1,#2)(#3,#4){\@ifnextchar
  80. [{\@imultiputlist(#1,#2)(#3,#4)}{\@imultiputlist(#1,#2)(#3,#4)[]}}
  81. \long\def\@imultiputlist(#1,#2)(#3,#4)[#5]#6{{%
  82. \@xdim=#1\unitlength \@ydim=#2\unitlength
  83. \listnonemptytrue \def\@@mlist{,#6,} % need this for end condition
  84. \loop
  85. \lop\@@mlist\to\@@firstoflist
  86. \@killglue\raise\@ydim\hbox to\z@{\hskip
  87. \@xdim\@imakepicbox(0,0)[#5]{\@@firstoflist}\hss}
  88. \advance\@xdim #3\unitlength\advance\@ydim #4\unitlength
  89. \ifx\@@mlist\@@mlistempty \listnonemptyfalse\fi
  90. \iflistnonempty
  91. \repeat\relax
  92. \ignorespaces}}
  93. %----------------------------------------------------------------------
  94. % two-dimensional version of \multiput
  95. % \matrixput(0,0)(20,0){5}(0,20){3}{\circle{2}}
  96. %----------------------------------------------------------------------
  97. \newcount\@@multicnt
  98. \def\matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{%
  99. \ifnum#5>#8\@matrixput(#1,#2)(#3,#4){#5}(#6,#7){#8}{#9}%
  100. \else\@matrixput(#1,#2)(#6,#7){#8}(#3,#4){#5}{#9}\fi}
  101. %% here #5 >= #8
  102. \long\def\@matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{{\@killglue%
  103. \@multicnt=#5\relax\@@multicnt=#8\relax%
  104. \@xdim=0pt%
  105. \@ydim=0pt%
  106. \setbox\@tempboxa\hbox{\@whilenum \@multicnt > 0\do {%
  107. %%\typeout{\the\@multicnt, \the\@@multicnt}%
  108. \raise\@ydim\hbox to \z@{\hskip\@xdim #9\hss}%
  109. \advance\@multicnt \m@ne%
  110. \advance\@xdim #3\unitlength\advance\@ydim #4\unitlength}}%
  111. \@xdim=#1\unitlength%
  112. \@ydim=#2\unitlength%
  113. \@whilenum \@@multicnt > 0\do {%
  114. \raise\@ydim\hbox to \z@{\hskip\@xdim \copy\@tempboxa\hss}%
  115. \advance\@@multicnt \m@ne%
  116. \advance\@xdim #6\unitlength\advance\@ydim #7\unitlength}%
  117. \ignorespaces}}
  118. %----------------------------------------------------------------------
  119. %\grid(wd,ht)(delta-wd,delta-ht)[initial-X-integer,initial-Y-integer]
  120. % example: 1. \put(0,0){\grid(95,100)(9.5,10)}
  121. %          2. \put(0,0){\grid(100,100)(10,5)[-10,0]}
  122. %          or \put(0,0){\tiny \grid(100,100)(5,5)[0,0]}%numbers in \tiny font
  123. %----------------------------------------------------------------------
  124. \newcount\d@lta
  125. \newdimen\@delta
  126. \newdimen\@@delta
  127. \newcount\@gridcnt
  128. \def\grid(#1,#2)(#3,#4){\@ifnextchar [{\@igrid(#1,#2)(#3,#4)}%
  129. {\@igrid(#1,#2)(#3,#4)[@,@]}}
  130. \long\def\@igrid(#1,#2)(#3,#4)[#5,#6]{%
  131. \makebox(#1,#2){%
  132. \@delta=#1pt\@@delta=#3pt\divide\@delta \@@delta\d@lta=\@delta%
  133. \advance\d@lta \@ne\relax\message{grid=\the\d@lta\space x}%
  134. %% copied the definition of \line(0,1){#2} for some efficiency!.
  135. \multiput(0,0)(#3,0){\d@lta}{\hbox to\z@{\hskip -\@halfwidth \vrule
  136.      \@width \@wholewidth \@height #2\unitlength \@depth \z@\hss}}%
  137. \ifx#5@\relax\else%
  138. \global\@gridcnt=#5%
  139. \multiput(0,0)(#3,0){\d@lta}{%
  140. \makebox(0,-2)[t]{\number\@gridcnt\global\advance\@gridcnt by #3}}%
  141. \global\@gridcnt=#5%
  142. \multiput(0,#2)(#3,0){\d@lta}{\makebox(0,0)[b]{\number\@gridcnt\vspace{2mm}%
  143. \global\advance\@gridcnt by #3}}%
  144. \@delta=#2pt\@@delta=#4pt\divide\@delta \@@delta\d@lta=\@delta%
  145. \advance\d@lta \@ne\relax\message{\the\d@lta . }%
  146. %% copied the definition of \line(1,0){#1} for some efficiency!.
  147. \multiput(0,0)(0,#4){\d@lta}{\vrule \@height \@halfwidth \@depth \@halfwidth
  148.      \@width #1\unitlength}%
  149. \ifx#6@\relax\else
  150. \global\@gridcnt=#6%
  151. \multiput(0,0)(0,#4){\d@lta}{%
  152. \makebox(0,0)[r]{\number\@gridcnt\ \global\advance\@gridcnt by #4}}%
  153. \global\@gridcnt=#6%
  154. \multiput(#1,0)(0,#4){\d@lta}{%
  155. \makebox(0,0)[l]{\ \number\@gridcnt\global\advance\@gridcnt by #4}}%
  156. \fi}}
  157. %----------------------------------------------------------------------
  158. % \picsquare is a centered square of dimensions governed by \thinlines,
  159. % \thicklines or \linethickness declarations.
  160. \def\picsquare{\hskip -0.5\@wholewidth%
  161. \vrule height \@halfwidth depth \@halfwidth width \@wholewidth}
  162. % just a square dot with reference point at bottom-left
  163. \def\picsquare@bl{\vrule height \@wholewidth depth \z@  width \@wholewidth}
  164. %----------------------------------------------------------------------
  165. % \begin{dottedjoin}{interdot-gap in units}
  166. % .....            
  167. % \end{dottedjoin}
  168. % \begin{dashjoin}{dash-length in units}{interdotgap in each dash}
  169. % .....            
  170. % \end{dashjoin}
  171. % \begin{drawjoin}
  172. % .....
  173. % \end{drawjoin}
  174. % \jput(x,y){character}
  175. % \dottedline[opt. dotcharacter]{dotgap in units}(x1,y1)(x2,y2)...(xN,yN)
  176. % \dashline[#]{dash-length}[opt. dotgap](x1,y1)(x2,y2)...(xN,yN)
  177. % \drawline[#](x1,y1)(x2,y2)...(xN,yN)
  178. %----------------------------------------------------------------------
  179. % definitions for *join environment. had to do all this mess because of
  180. % optional arguments.
  181. %----------------------------------------------------------------------
  182. \newif\if@jointhem \global\@jointhemfalse
  183. \newif\if@firstpoint \global\@firstpointtrue
  184. \newcount\@joinkind
  185. %\newenvironment{dottedjoin}[1]%[opt char]{dotgap}
  186. %{\global\@jointhemtrue \gdef\dotgap@join{#1}\global\@joinkind=0\relax}%
  187. %{\global\@jointhemfalse \global\@firstpointtrue}
  188. %----------------------------------------------------------------------
  189. \def\dottedjoin{\global\@jointhemtrue \global\@joinkind=0\relax
  190.   \bgroup\@ifnextchar[{\@idottedjoin}{\@idottedjoin[\picsquare@bl]}}
  191. \def\@idottedjoin[#1]#2{\gdef\dotchar@join{#1}\gdef\dotgap@join{#2}}
  192. \def\enddottedjoin{\global\@jointhemfalse \global\@firstpointtrue\egroup}
  193. %----------------------------------------------------------------------
  194. \def\dashjoin{\global\@jointhemtrue \global\@joinkind=1\relax
  195.   \bgroup\@ifnextchar[{\@idashjoin}{\@idashjoin[\dashlinestretch]}}
  196. \def\@idashjoin[#1]#2{\edef\dashlinestretch{#1}\gdef\dashlen@join{#2}%
  197. \@ifnextchar[{\@iidashjoin}{\gdef\dotgap@join{}}}
  198. \def\@iidashjoin[#1]{\gdef\dotgap@join{#1}}
  199. \let\enddashjoin\enddottedjoin
  200. %----------------------------------------------------------------------
  201. \def\drawjoin{\global\@jointhemtrue \global\@joinkind=2\relax
  202.   \bgroup\@ifnextchar[{\@idrawjoin}{}}
  203. \def\@idrawjoin[#1]{\def\drawlinestretch{#1}}
  204. \let\enddrawjoin\enddottedjoin
  205. %----------------------------------------------------------------------
  206. %% this is equiv to \put(x,y){#1} when not in {dot*join} environment.
  207. \long\def\jput(#1,#2)#3{{\@killglue\raise#2\unitlength\hbox to \z@{\hskip
  208. #1\unitlength #3\hss}\ignorespaces}
  209. \if@jointhem
  210.  \if@firstpoint \gdef\x@one{#1} \gdef\y@one{#2} \global\@firstpointfalse
  211.  \else\ifcase\@joinkind
  212.     \@dottedline[\dotchar@join]{\dotgap@join\unitlength}%
  213. (\x@one\unitlength,\y@one\unitlength)(#1\unitlength,#2\unitlength)
  214.     \or\@dashline[\dashlinestretch]{\dashlen@join}[\dotgap@join]%
  215. (\x@one,\y@one)(#1,#2)
  216.     \else\@drawline[\drawlinestretch](\x@one,\y@one)(#1,#2)\fi
  217.     \gdef\x@one{#1} \gdef\y@one{#2}
  218. %----------------------------------------------------------------------
  219. \newdimen\@dotgap
  220. \newdimen\@ddotgap
  221. \newcount\@x@diff
  222. \newcount\@y@diff
  223. \newdimen\x@diff
  224. \newdimen\y@diff
  225. \newbox\@dotbox
  226. \newcount\num@segments
  227. \newcount\num@segmentsi
  228. \newif\ifsqrt@done
  229. %% from sqrtandstuff func basically need \num@segments.
  230. %% given a deltax, deltay and dotgap, it calculates \num@segments = number of
  231. %% segments along the hypotenuse. used by \dottedline & \dashline.
  232. %% It finishes quickly if any of deltax or deltay are zero or close to zero.
  233. \def\sqrtandstuff#1#2#3{
  234. \ifdim #1 <0pt \@x@diff= -#1 \else\@x@diff=#1\fi
  235. \ifdim #2 <0pt \@y@diff= -#2 \else\@y@diff=#2\fi
  236. %% @diff's will be positive and diff's will retain their sign.
  237. \@dotgap=#3 \divide\@dotgap \tw@
  238. \advance\@x@diff \@dotgap \advance\@y@diff \@dotgap% for round-off errors
  239. \@dotgap=#3
  240. \divide\@x@diff \@dotgap \divide\@y@diff \@dotgap
  241. \sqrt@donefalse
  242. \ifnum\@x@diff < 2
  243.    \ifnum\@y@diff < 2 \num@segments=\@x@diff \advance\num@segments \@y@diff
  244.               \sqrt@donetrue
  245.         \else\num@segments=\@y@diff \sqrt@donetrue\fi
  246.    \else\ifnum\@y@diff < 2 \num@segments=\@x@diff \sqrt@donetrue\fi
  247. \ifsqrt@done \ifnum\num@segments=\z@ \num@segments=\@ne\fi\relax
  248.  \else \ifnum\@y@diff >\@x@diff
  249.          \@tempcnta=\@x@diff \@x@diff=\@y@diff \@y@diff=\@tempcnta
  250.        \fi            %exchange @x@diff & @y@diff, so now @x@diff > @y@diff
  251.   \num@segments=\@y@diff
  252.   \multiply\num@segments \num@segments
  253.   \multiply\num@segments by 457
  254.   \divide\num@segments \@x@diff
  255.   \advance\num@segments by 750 % for round-off, going to divide by 1000.
  256.   \divide\num@segments \@m
  257.   \advance\num@segments \@x@diff
  258.         %num@segments = @x@diff + (0.457*sqr(@y@diff)/@x@diff)
  259. %----------------------------------------------------------------------
  260. % \dottedline[opt. char]{interdot gap in units}(x1,y1)(x2,y2)....(xN,yN)
  261. %----------------------------------------------------------------------
  262. %% Used the following construction earlier but that results in box memory
  263. %% full much too soon although it works perfectly.
  264. %% \setbox\@dotbox\vbox to\z@{\vss \hbox to\z@{\hss #1\hss}\vss}\relax}
  265. %% The cenetering of characters is achieved by substracting half the ht, wd
  266. %% of character from the (x,y) coordinates where they are to be put. We
  267. %% chose to use a macro for the ``dot'' instead of \copy\box to save memory
  268. %% at the expense of extra cpu, since memory becomes an issue very soon.
  269. %% \picsquare is already centered, whereas other characters, except \circle,
  270. %% will not be cenetered, hence to handle them all in a similar fashion,
  271. %% used \picsquare@bl.
  272. % kind of tail recursion.
  273. \def\dottedline{\@ifnextchar [{\@idottedline}{\@idottedline[\picsquare@bl]}}
  274. \def\@idottedline[#1]#2(#3,#4){\@ifnextchar (%
  275. {\@iidottedline[#1]{#2}(#3,#4)}{\relax}}
  276. \def\@iidottedline[#1]#2(#3,#4)(#5,#6){\@dottedline[#1]{#2\unitlength}%
  277. (#3\unitlength,#4\unitlength)(#5\unitlength,#6\unitlength)%
  278. \@idottedline[#1]{#2}(#5,#6)}
  279. %% user not supposed to use this directly. arguments in absolute dimensions.
  280. %% need to pass absolute dimens here because dashline calls dottedline and
  281. %% can supply only absolute dimensions.
  282. \long\def\@dottedline[#1]#2(#3,#4)(#5,#6){{%
  283. \x@diff=#5\relax\advance\x@diff by -#3\relax
  284. \y@diff=#6\relax\advance\y@diff by -#4\relax
  285. \sqrtandstuff{\x@diff}{\y@diff}{#2}
  286. \divide\x@diff \num@segments
  287. \divide\y@diff \num@segments
  288. \advance\num@segments \@ne     % to put the last point at destination.
  289. %%\typeout{num@segments= \the\num@segments}
  290. \setbox\@dotbox\hbox{#1}% just to get the dimensions of the character.
  291. \@xdim=#3 \@ydim=#4
  292. \ifdim\ht\@dotbox >\z@% otherwise its a circle.
  293.   \advance\@xdim -0.5\wd\@dotbox
  294.   \advance\@ydim -0.5\ht\@dotbox
  295.   \advance\@ydim .5\dp\@dotbox\fi
  296. %%circle's have a ht=0, this is one way I could think of to catch circles.
  297. %%following loop is equiv to
  298. %%\multiput(\@xdim,\@ydim)(\x@diff,\y@diff){\num@segments}{#1}
  299. %%with arguments in absolute dimensions.
  300. \@killglue
  301. \loop \ifnum\num@segments > 0
  302. \unskip\raise\@ydim\hbox to\z@{\hskip\@xdim #1\hss}%
  303. \advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff%
  304. \repeat
  305. \ignorespaces}}
  306. %----------------------------------------------------------------------
  307. % \dashline[#]{dash-length}[optional dotgap](x1,y1)(x2,y2)...(xN,yN)
  308. % The minimum # of dashes put is 2, one at either end point; dash-length is
  309. % reduced accordingly if necessary. Also have to some dirty work to account
  310. % for stretch & shrink.
  311. % \renewcommand{\dashlinestretch}{-50}  %ONLY INTEGERS PERMITTED.
  312. %----------------------------------------------------------------------
  313. \def\dashlinestretch{0} %well, could have used a counter.
  314. \def\dashline{\@ifnextchar [{\@idashline}{\@idashline[\dashlinestretch]}}
  315. \def\@idashline[#1]#2{\@ifnextchar [{\@iidashline[#1]{#2}}%
  316. {\@iidashline[#1]{#2}[\@empty]}} %\@empty needed-- later checked with \ifx 
  317. \def\@iidashline[#1]#2[#3](#4,#5){\@ifnextchar (%
  318. {\@iiidashline[#1]{#2}[#3](#4,#5)}{\relax}}
  319. \def\@iiidashline[#1]#2[#3](#4,#5)(#6,#7){%
  320. \@dashline[#1]{#2}[#3](#4,#5)(#6,#7)%
  321. \@iidashline[#1]{#2}[#3](#6,#7)}
  322. \long\def\@dashline[#1]#2[#3](#4,#5)(#6,#7){{%
  323. \x@diff=#6\unitlength \advance\x@diff by -#4\unitlength
  324. \y@diff=#7\unitlength \advance\y@diff by -#5\unitlength
  325. %% correction to get actual width since the dash-length as taken in arguement
  326. %% is the center-to-center of the end-points.
  327. \@tempdima=#2\unitlength \advance\@tempdima -\@wholewidth
  328. \sqrtandstuff{\x@diff}{\y@diff}{\@tempdima}
  329. \ifnum\num@segments <3 \num@segments=3\fi% min number of dashes I can plot
  330. % is 2, 1 at either end, thus min num@segments is 3 (including 'empty dash').
  331. \@tempdima=\x@diff \@tempdimb=\y@diff
  332. \divide\@tempdimb by\num@segments
  333. \divide\@tempdima by\num@segments
  334. %% ugly if-then-else. If optional dotgap specified, then use it otherwise
  335. %% make a solid looking dash.
  336. {\ifx#3\@empty \relax
  337.     \ifdim\@tempdima < 0pt \x@diff=-\@tempdima\else\x@diff=\@tempdima\fi
  338.     \ifdim\@tempdimb < 0pt \y@diff=-\@tempdimb\else\y@diff=\@tempdimb\fi
  339.     \ifdim\x@diff < 0.3pt %it's a vertical dashline
  340.            \ifdim\@tempdimb > 0pt
  341.             \global\setbox\@dotbox\hbox{\hskip -\@halfwidth \vrule
  342.          \@width \@wholewidth \@height \@tempdimb}
  343.        \else\global\setbox\@dotbox\hbox{\hskip -\@halfwidth \vrule
  344.          \@width \@wholewidth \@height\z@ \@depth -\@tempdimb}\fi
  345.        \else\ifdim\y@diff < 0.3pt %it's a horizontal dashline
  346.                \ifdim\@tempdima >0pt
  347.           \global\setbox\@dotbox\hbox{\vrule \@height \@halfwidth
  348.                  \@depth \@halfwidth \@width \@tempdima}
  349.         \else\global\setbox\@dotbox\hbox{\hskip \@tempdima
  350.              \vrule \@height \@halfwidth \@depth \@halfwidth
  351.                  \@width -\@tempdima \hskip \@tempdima}\fi
  352.         \else\global\setbox\@dotbox\hbox{%
  353. \@dottedline[\picsquare]{0.98\@wholewidth}(0pt,0pt)(\@tempdima,\@tempdimb)}
  354. \fi\fi
  355. \else\global\setbox\@dotbox\hbox{%
  356. \@dottedline[\picsquare]{#3\unitlength}(0pt,0pt)(\@tempdima,\@tempdimb)}
  357. \advance\x@diff by -\@tempdima % both have same sign
  358. \advance\y@diff by -\@tempdimb
  359. %%here we correct the number of dashes to be put by reducing them
  360. %%appropriately. (num@segments*\@wholewidth) is in some way the slack we
  361. %%have,and division by dash-length gives the reduction. reduction =
  362. %%(2*num@segments*\@wholewidth)/dash-length
  363. %% (num@segments includes empty ones)
  364. \@tempdima=\num@segments\@wholewidth \@tempdima=2\@tempdima 
  365. \@tempcnta=\@tempdima \@tempdima=#2\unitlength \@tempdimb=0.5\@tempdima
  366. \@tempcntb=\@tempdimb \advance\@tempcnta by \@tempcntb % round-off error
  367. \divide\@tempcnta by\@tempdima \advance\num@segments by -\@tempcnta
  368. \ifnum #1=0 \relax\else\ifnum #1 < -100
  369.   \typeout{***dashline: reduction > -100 percent implies blankness!***}
  370. \else\num@segmentsi=#1 \advance\num@segmentsi by 100
  371.      \multiply\num@segments by\num@segmentsi \divide\num@segments by 100
  372. \fi\fi
  373. \divide\num@segments by 2 % earlier num@segments included 'empty dashes' too.
  374. \ifnum\num@segments >0 % if =0 then don't divide => \x@diff & \y@diff
  375.  \divide\x@diff by\num@segments%   remain same.
  376.  \divide\y@diff by\num@segments
  377.  \advance\num@segments by\@ne %for the last segment for which I subtracted
  378.                   %\@tempdima & \@tempdimb from \x@diff & \y@diff
  379.  \else\num@segments=2 % one at each end.
  380. %%\typeout{num@segments finally = \the\num@segments}
  381. %% equiv to \multiput(#4,#5)(\x@diff,\y@diff){\num@segments}{\copy\@dotbox}
  382. %% with arguements in absolute dimensions.
  383. \@xdim=#4\unitlength \@ydim=#5\unitlength
  384. \@killglue
  385. \loop \ifnum\num@segments > 0
  386. \unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@dotbox\hss}%
  387. \advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff%
  388. \repeat
  389. \ignorespaces}}
  390. %----------------------------------------------------------------------
  391. %%1.00   .833333  .80  .75  .66666   .60  .50  .40  .33333    .25 .20  .16666
  392. %% .916666 .816666 .775 .708333 .633333 .55 .45 .366666 .291666 .225 .183333
  393. %% 0.0
  394. %%0.083333
  395. %% the first line has absolute slopes corresponding to various permissible
  396. %% integer combinations representing slopes. The second line is the midpoint
  397. %% of all those slopes (attempted to show them in the middle of two entries).
  398. %% \lineslope(x@diff dimen, y@diff dimen)
  399. %% Given base (x@diff) and height (y@diff) in dimensions, determines the
  400. %% closest available slope and returns the two required integers in \@xarg
  401. %% and \@yarg. The given base and height can be ANYTHING, -ve or +ve, or
  402. %% even 0pt. \lineslope knows about (0,1) and (1,0) slopes too and returns
  403. %% correct values if the conditions regarding x@diff & y@diff are obeyed
  404. %% (see NOTE). Used by \drawline. This is the simplest and only way I could
  405. %% figure out to accomplish it!.
  406. %% NOTE: both the dimensions (x@diff & y@diff) must be in SAME units and the
  407. %% larger of the two dimensions must be atleast 1pt (i.e. 65536sp). To avoid
  408. %% dividing by 0, I make the larger dimension = 1pt if it is < 1pt.
  409. %% will need a similar one for vectors, or maybe this can be used. For
  410. %% vectors the range is -4, 4 unlike lines where it is -6, 6.
  411. \newif\if@flippedargs
  412. \def\lineslope(#1,#2){%
  413. \ifdim #1 <0pt \@xdim= -#1 \else\@xdim=#1\fi
  414. \ifdim #2 <0pt \@ydim= -#2 \else\@ydim=#2\fi
  415. %%\typeout{xdim,ydim= \the\@xdim, \the\@ydim}
  416. \ifdim\@xdim >\@ydim \@tempdima=\@xdim \@xdim=\@ydim \@ydim=\@tempdima
  417. \@flippedargstrue\else\@flippedargsfalse\fi% x < y
  418. \ifdim\@ydim >1pt \@tempcnta=\@ydim
  419.             \divide\@tempcnta by 65536% now \@tempcnta=integral part of #1.
  420.             \divide\@xdim \@tempcnta\fi
  421. \ifdim\@xdim <.083333pt \@xarg=1 \@yarg=0
  422.  \else\ifdim\@xdim <.183333pt    \@xarg=6 \@yarg=1
  423.  \else\ifdim\@xdim <.225pt     \@xarg=5 \@yarg=1
  424.  \else\ifdim\@xdim <.291666pt     \@xarg=4 \@yarg=1
  425.  \else\ifdim\@xdim <.366666pt     \@xarg=3 \@yarg=1
  426.  \else\ifdim\@xdim <.45pt     \@xarg=5 \@yarg=2
  427.  \else\ifdim\@xdim <.55pt     \@xarg=2 \@yarg=1
  428.  \else\ifdim\@xdim <.633333pt     \@xarg=5 \@yarg=3
  429.  \else\ifdim\@xdim <.708333pt     \@xarg=3 \@yarg=2
  430.  \else\ifdim\@xdim <.775pt     \@xarg=4 \@yarg=3
  431.  \else\ifdim\@xdim <.816666pt     \@xarg=5 \@yarg=4
  432.  \else\ifdim\@xdim <.916666pt     \@xarg=6 \@yarg=5
  433.        \else            \@xarg=1 \@yarg=1%
  434. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  435. \if@flippedargs\relax\else\@tempcnta=\@xarg \@xarg=\@yarg
  436.               \@yarg=\@tempcnta\fi
  437. \ifdim #1 <0pt \@xarg= -\@xarg\fi
  438. \ifdim #2 <0pt \@yarg= -\@yarg\fi
  439. %%\typeout{closest slope integers = \the\@xarg, \the\@yarg}
  440. %----------------------------------------------------------------------
  441. % usage: \drawline[#](x1,y1)(x2,y2)....(xN,yN)
  442. %                % # is an optional integer between -100 & infinity.
  443. % \renewcommand{\drawlinestretch}{-50}  %ONLY INTEGERS PERMITTED.
  444. %----------------------------------------------------------------------
  445. \newif\if@toosmall
  446. \newif\if@drawit
  447. \newif\if@horvline
  448. \def\drawlinestretch{0} %well, could have used a counter.
  449. % kind of tail recursion.
  450. \def\drawline{\@ifnextchar [{\@idrawline}{\@idrawline[\drawlinestretch]}}
  451. \def\@idrawline[#1](#2,#3){\@ifnextchar ({\@iidrawline[#1](#2,#3)}{\relax}}
  452. \def\@iidrawline[#1](#2,#3)(#4,#5){\@drawline[#1](#2,#3)(#4,#5)
  453. \@idrawline[#1](#4,#5)}
  454. \def\@drawline[#1](#2,#3)(#4,#5){{%
  455. \x@diff=#4\unitlength \advance\x@diff by -#2\unitlength
  456. \y@diff=#5\unitlength \advance\y@diff by -#3\unitlength
  457. %% override any linethickness declarations, and since horiz & vertical lines
  458. %% come out thinner than the slanted ones, assign slightly larger values.
  459. %% default values are: thinlines=0.4pt, thicklines=0.8pt
  460. \ifx\@linefnt\tenln \linethickness{0.5pt} \else \linethickness{0.9pt}\fi
  461. \lineslope(\x@diff,\y@diff)% returns the two integers in \@xarg & \@yarg.
  462. %------
  463. \@toosmalltrue
  464. {\ifdim\x@diff <\z@ \x@diff=-\x@diff\fi
  465.  \ifdim\y@diff <\z@ \y@diff=-\y@diff\fi
  466.  \ifdim\x@diff >10pt \global\@toosmallfalse\fi
  467.  \ifdim\y@diff >10pt \global\@toosmallfalse\fi}
  468. %------
  469. %% For efficiency, if the line is horiz or vertical then we draw it in one
  470. %% shot, only if the stretch is not -ve and the line is not too small.
  471. \@drawitfalse\@horvlinefalse
  472. \ifnum#1 <0 \relax\else\@horvlinetrue\fi
  473. \if@toosmall\@horvlinetrue\fi% to get 'or' condition. We necessarily draw a 
  474. % solid line if the line is too small ignoring any -ve stretch.
  475. \if@horvline
  476.  \ifdim\x@diff =0pt \put(#2,#3){\ifdim\y@diff >0pt \@linelen=\y@diff \@upline
  477.                  \else\@linelen=-\y@diff \@downline\fi}%
  478.  \else\ifdim\y@diff =0pt
  479.           \ifdim\x@diff >0pt \put(#2,#3){\vrule \@height \@halfwidth \@depth
  480.                 \@halfwidth \@width \x@diff}
  481.         \else \put(#4,#5){\vrule \@height \@halfwidth \@depth
  482.                 \@halfwidth \@width -\x@diff}\fi
  483.        \else\@drawittrue\fi\fi % construct the line explicitly
  484. \else\@drawittrue\fi
  485. %-------------------------------
  486. \if@drawit
  487. \ifnum\@xarg< 0 \@negargtrue\else\@negargfalse\fi
  488. \ifnum\@xarg =0 \setbox\@linechar%
  489. \hbox{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height 10.2pt
  490.  \@depth \z@}
  491. \else \ifnum\@yarg =0 \setbox\@linechar%
  492. \hbox{\vrule \@height \@halfwidth \@depth \@halfwidth \@width 10.2pt}
  493. \else \if@negarg \@xarg -\@xarg \@yyarg -\@yarg
  494.         \else \@yyarg \@yarg\fi
  495. \ifnum\@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg\fi
  496. \setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}%
  497. \fi\fi
  498. %------
  499. \if@toosmall% => it isn't a horiz or vert line and is toosmall.
  500.   \@dottedline[\picsquare]{.98\@wholewidth}%
  501. (#2\unitlength,#3\unitlength)(#4\unitlength,#5\unitlength)%
  502. \else
  503. %% following is neat. The last segment takes \wd\@linechar & \ht\@linechar
  504. %% so plot the line as though it were from (#2,#3) to
  505. %% (#4-\wd\@linechar,#5-\ht\@linechar) (i.e. for positive slope; of course,
  506. %% signs are reversed for other slopes). For horizontal & vertical dashes we
  507. %% don't have to subtract the ht & wd resp. since they are already centered.
  508. \ifnum\@xarg=0\relax\else\ifdim\x@diff >\z@ \advance\x@diff -\wd\@linechar
  509.   \else\advance\x@diff \wd\@linechar\fi\fi
  510. \ifnum\@yarg=0\relax\else\ifdim\y@diff >\z@\advance\y@diff -\ht\@linechar
  511.   \else\advance\y@diff \ht\@linechar\fi\fi
  512. \ifdim\x@diff <\z@ \@x@diff=-\x@diff \else\@x@diff=\x@diff\fi
  513. \ifdim\y@diff <\z@ \@y@diff=-\y@diff \else\@y@diff=\y@diff\fi
  514. %%\typeout{x@diff,y@diff=\the\x@diff , \the\y@diff}
  515. \num@segments=0 \num@segmentsi=0
  516. \ifdim\wd\@linechar >1pt
  517.  \num@segmentsi=\@x@diff \divide\num@segmentsi \wd\@linechar\fi
  518. \ifdim\ht\@linechar >1pt
  519.  \num@segments=\@y@diff \divide\num@segments \ht\@linechar\fi
  520. \ifnum\num@segmentsi >\num@segments \num@segments=\num@segmentsi\fi
  521. \advance\num@segments \@ne %to account for round-off error
  522. \ifnum #1=0 \relax \else\ifnum #1 < -99
  523.   \typeout{***drawline: reduction <= -100 percent implies blankness!***}
  524. \else\num@segmentsi=#1 \advance\num@segmentsi by 100
  525.      \multiply\num@segments \num@segmentsi
  526.      \divide\num@segments by 100
  527. \fi\fi
  528. %%\typeout{num@segments after = \the\num@segments}
  529. \divide\x@diff \num@segments
  530. \divide\y@diff \num@segments
  531. \advance\num@segments \@ne %for the last segment for which I subtracted
  532.               %\wd & \ht of \@linechar from \@x@diff & \@y@diff.
  533. %%\typeout{numseg,x@diff,y@diff= \the\num@segments, \the\x@diff, \the\y@diff}
  534. \@xdim=#2\unitlength \@ydim=#3\unitlength
  535. \if@negarg \advance\@xdim -\wd\@linechar\fi
  536. \ifnum\@yarg <0 \advance\@ydim -\ht\@linechar\fi
  537. %%following loop equiv to \multiput@abs(\@xdim,\@ydim)%
  538. %%(\x@diff,\y@diff){\num@segments}{\copy\@linechar}
  539. %%with arguements in absolute dimensions.
  540. \@killglue
  541. \loop \ifnum\num@segments > 0
  542. \unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@linechar\hss}%
  543. \advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff%
  544. \repeat
  545. \ignorespaces
  546. \fi%the if of @toosmall
  547. \fi}}% for \if@drawit
  548. %----------------------------------------------------------------------
  549. %usage: \putfile{datafile}{OBJECT}
  550. % The OBJECT is plotted at EACH of the coordinates read from the datafile.
  551. % The idea of these macros is to generate (x,y) pairs using some program
  552. % and then directly use those coordinates. Since TeX doesn't have real
  553. % floating point calculations, it is much more efficient and accurate to do
  554. % things this way. One can also use the unix facility 'spline' now to
  555. % generate smooth curves with equidistant ``dots''.
  556. % NOTE: the external file of coordinates must have x y pairs with a space
  557. % between them. Also it is suggested that some extension such as '.put'
  558. % be used for such datafiles to distinguish them in which case it must
  559. % be explicitely specified in the 1st argument so that TeX doesn't look
  560. % for a .tex extension.
  561. % The % char remains valid as a comment char and such lines are ignored;
  562. % however, there should be atleast one space after the second entry if a
  563. % comment is on the same line as data since % eats up the newline.
  564. %-----------------------------------------------------------------------
  565. \long\def\splittwoargs#1 #2 {(#1,#2)}
  566. \newif\if@stillmore
  567. \newread\@datafile
  568. \long\def\putfile#1#2{\openin\@datafile = #1
  569. \@stillmoretrue
  570. \loop
  571. \ifeof\@datafile\relax\else\read\@datafile to\@dataline\fi
  572. %if file nonexistent, do nothing.
  573. \ifeof\@datafile\@stillmorefalse
  574. \else\ifx\@dataline\@empty \relax
  575.      \else
  576. \expandafter\expandafter\expandafter\put\expandafter\splittwoargs%
  577. \@dataline{#2}
  578.      \fi
  579. \if@stillmore
  580. \repeat
  581. \closein\@datafile
  582. %----------------------------------------------------------------------
  583. \makeatother
  584. SHAR_EOF
  585. if test 25824 -ne "`wc -c < 'epic.sty'`"
  586.     echo shar: "error transmitting 'epic.sty'" '(should have been 25824 characters)'
  587. echo shar: "extracting 'misc.sty'" '(2444 characters)'
  588. if test -f 'misc.sty'
  589.     echo shar: "will not over-write existing file 'misc.sty'"
  590. cat << \SHAR_EOF > 'misc.sty'
  591. % podar@sbcs (Sunil Podar) July 14, 1986
  592. % following commands implemented here (see the comments below for more info):
  593. % \pmb
  594. % \timeofday
  595. % \verbfile
  596. % \listing
  597. %----------------------------------------------------------------------------
  598. % poor man's bold. from pp. 386 of TeXbook. 1.732*0.025=0.0433 (the ratio of
  599. % em to ex)
  600. \newdimen\pmboffset
  601. \pmboffset 0.025em
  602. \def\pmb#1{\setbox0=\hbox{#1}%
  603.  \kern-\pmboffset\copy0\kern-\wd0
  604.  \kern 2\pmboffset\copy0\kern-\wd0
  605.  \kern-\pmboffset\raise 1.732\pmboffset\box0 }
  606. %----------------------------------------------------------------------------
  607. % \timeofday is just like \today; it gives the current time of day in the form
  608. % hh:mm as in the military style. It eats up a blank so normally one would
  609. % say: \timeofday\  (i.e. a \<space>.
  610. \def\timeofday{{\@tempcnta=\time \divide\@tempcnta by 60 \@tempcntb=\@tempcnta
  611. \multiply\@tempcntb by 60 \advance\@tempcntb by -\time %@tempcntb is -ve here
  612. \ifnum\@tempcntb < -9 \number\@tempcnta:\number-\@tempcntb
  613.   \else\number\@tempcnta:0\number-\@tempcntb\fi}}
  614. %----------------------------------------------------------------------------
  615. %From: Tim Morgan <morgan@uci-icsa>
  616. %Subject: verbatim macros
  617. %Here are some macros which I mostly stole from the TeXbook source and
  618. %other places.  You can say
  619. %    \verbfile{filename}
  620. %to \input all of "filename" in verbatim mode.  The end of the file is the
  621. %only thing that gets you back out of verbatim -- no characters are special.
  622. %\listing is the same except that each line of the file is automatically
  623. %numbered.
  624. % Produce verbatim listings of various sorts
  625. \def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials}
  626. \def\setupverbatim{%
  627.     \par \tt \spaceskip=0pt    % Make sure we get fixed tt spacing
  628.     \obeylines\uncatcodespecials\obeyspaces\verbatimdefs
  629. {\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }}
  630.   \gdef\verbatimgobble#1^^M{}}
  631. % Input a file in verbatim mode.  Sometimes useful for including
  632. % real-life examples into a paper.
  633. \def\verbfile#1{\begingroup\setupverbatim
  634.     \parskip=0pt plus .05\baselineskip \parindent=0pt
  635.     \input#1 \endgroup
  636. % This is the same as the above, but it adds line numbers to each
  637. % line of the file printed.
  638. \newcount\lineno
  639. \def\listing#1{\lineno=0\begingroup\setupverbatim
  640.     \parskip=0pt plus .05\baselineskip \parindent=20pt
  641.     \everypar{\advance\lineno by 1 \llap{\the\lineno\ \ }}\input#1
  642.     \endgroup
  643. SHAR_EOF
  644. if test 2444 -ne "`wc -c < 'misc.sty'`"
  645.     echo shar: "error transmitting 'misc.sty'" '(should have been 2444 characters)'
  646. exit 0
  647. #    End of shell archive
  648.